/*
 * Copyright (C) 2009 Otávio Scherer Garcia
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.googlecode.technorati4j.entity;

import org.jdom.Element;

import com.googlecode.technorati4j.util.StringUtils;

/**
 * XXXXXXXXXXXXXXXXXXXXXXXXX.
 * 
 * @author Otávio Scherer Garcia
 * @version $Revision$
 */
public final class TopTagsResponseItem {

    /**
     * The tag.
     */
    private String tag;

    /**
     * Number of posts with this tag.
     */
    private Integer posts;

    public TopTagsResponseItem(Element element) {
        tag = element.getChildText("tag");
        posts = StringUtils.toInteger(element.getChildText("posts"));
    }

    public String getTag() {
        return tag;
    }

    public void setTag(String tag) {
        this.tag = tag;
    }

    public Integer getPosts() {
        return posts;
    }

    public void setPosts(Integer posts) {
        this.posts = posts;
    }

    @Override
    public String toString() {
        final StringBuilder str = new StringBuilder();
        str.append("tag=");
        str.append(tag);
        str.append("&posts=");
        str.append(posts);

        return str.toString();
    }
}
